package com.engine.liteflow.context;


import com.engine.core.gen.Global;
import com.engine.core.interceptor.JdbcCommandContext;
import com.engine.core.util.Response;
import com.engine.dialect.DialectType;
import com.yomahub.liteflow.context.ContextBean;
import org.springframework.context.ApplicationContext;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.HashMap;
import java.util.Map;

@ContextBean("jdbcContext")
public class LiteflowJdbcCommandContext  extends JdbcCommandContext  {

    /**
     * 最后一次action的返回值
     */
    private Response lastResponse;

    private Map<String,Object> nextArgs=new HashMap();

    public LiteflowJdbcCommandContext(Global global, JdbcTemplate jdbcTemplate,
                                      ApplicationContext applicationContext, DialectType dialectType) {
        super(global, jdbcTemplate, applicationContext, dialectType);
        this.put("nextArgs",nextArgs);
    }

    public void setLastResponse(Response response){
         this.setLastResponse(response);
    }


    public Response getLastResponse(){
        return this.lastResponse;
    }

    public Map<String,Object> getNextArgs(){
        return this.nextArgs;
    }

    public void setNextArgs(Map<String,Object> nextArgs){
        this.nextArgs.putAll(nextArgs);
    }

    public void setNextArg(String key,Object value){
        this.nextArgs.put(key,value);
    }







}
